#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <ctype.h>
#include <string.h>

char* shortestCompletingWord(char* licensePlate, char** words, int wordsSize) {
    int cnt[26];
    int n = strlen(licensePlate);
    memset(cnt, 0, sizeof(cnt));

    for (int i = 0; i < n; ++i) {
        if (isalpha(licensePlate[i])) {
            ++cnt[tolower(licensePlate[i]) - 'a'];
        }
    }
    int idx = -1;
    int minLen = INT_MAX;
    for (int i = 0; i < wordsSize; ++i) {
        int currLen = strlen(words[i]);
        int c[26];
        memset(c, 0, sizeof(c));
        for (int j = 0; j < currLen; ++j) {
            ++c[words[i][j] - 'a'];
        }
        bool ok = true;
        for (int j = 0; j < 26; ++j) {
            if (c[j] < cnt[j]) {
                ok = false;
                break;
            }
        }
        if (ok && (idx < 0 || currLen < minLen)) {
            minLen = currLen;
            idx = i;
        }
    }
    return words[idx];
}


int main()
{
	return 0;
}